﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using Entities;

namespace Mapping
{
    public class PlaceInfoMapping : ClassMap<PlaceInfo>
    {
        public PlaceInfoMapping()
        {
            Table("Place_Info");
            Id(o => o.Id);
            Map(o => o.Name).Length(1000);
            Map(o => o.Address).Length(1000);
            Map(o => o.Phone);
            Map(o => o.WebsiteUrl).Length(1000);
            Map(o => o.AboutUsPageUrl).Length(1000);
            Map(o => o.ContactUsPageUrl).Length(1000);
            Map(o => o.Reference).Length(1000);
            Map(o => o.FacebookPageUrl).Length(1000);
            Map(o => o.Pinterest).Length(1000);
            Map(o => o.DoesIncludePinItButton);
            Map(o => o.Likes);
            HasMany(o=>o.PinterestUserInfo).AsBag()
                                           .Inverse()
                                           .Cascade.All();

            HasMany(x => x.Emails).Table("Emails")
                                  .Element("Emails").AsBag();
        }
    }
}
